package cn.skyquant.quant4j.service.boot.web.controller;

import cn.skyquant.quant4j.api.dto.ResultDTO;
import cn.skyquant.quant4j.sdk.util.bean.BeanTools;
import cn.skyquant.quant4j.sdk.util.bean.EnumEntity;
import cn.skyquant.quant4j.service.boot.web.annotation.NoVerify;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/enum")
@NoVerify
public class EnumController {

    private static final String enumsPackage = "cn.skyquant.quant4j.api.enums.";

    /**配置项管理**/
    @RequestMapping(value = "/{name}",method = RequestMethod.GET)
    @ResponseBody
    public ResultDTO<List<EnumEntity>> list(
            @PathVariable(required = true) String name) {
        return ResultDTO.success(BeanTools.getEnumFields(enumsPackage+name));
    }
}
